home *** CD-ROM | disk | FTP | other *** search
- Path: pc0734.ri.bbsrc.ac.uk!user
- From: Andy.Law@bbsrc.ac.uk (Andy Law)
- Newsgroups: comp.lang.c,comp.lang.c++
- Subject: Incrementing enumerated types
- Date: Wed, 31 Jan 1996 11:38:30 +0000
- Organization: Roslin Institute
- Message-ID: <Andy.Law-3101961138310001@pc0734.ri.bbsrc.ac.uk>
- Reply-To: Andy.Law@bbsrc.ac.uk
- NNTP-Posting-Host: pc0734.ri.bbsrc.ac.uk
- X-Newsreader: Yet Another NewsWatcher 2.1.8
-
- Is it legal to increment an enumerated type? I have an enumerated list of
- possible document types that I want to step through, and my compiler is
- barfing on it. It seems such a waste of an enumeration if I have to resort
- to ints to get this done.
-
- Alternatively does anyone have a suggestion as to how to do this kind of
- thing legally?
-
- for (EnumeratedType eIndex = enum_first; eIndex < enum_last; eIndex++) {
- ^^^^^^^^
- /* do something */
- }
-
- TIA,
-
- Andy Law
- ------------------
- ( Andy.Law@bbsrc.ac.uk )
- ( Big Nose in Edinburgh )
-